﻿namespace UnityEditor
{
    using System;
    using System.Runtime.CompilerServices;
    using UnityEngine;

    public sealed class AudioImporter : AssetImporter
    {
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern int Internal_GetLoadType();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern int Internal_GetMaxBitrate(int type);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern int Internal_GetMinBitrate(int type);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern int Internal_GetType();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern void Internal_SetLoadType(int flag);
        internal int maxBitrate(AudioType type)
        {
            return this.Internal_GetMaxBitrate((int) type);
        }

        internal int minBitrate(AudioType type)
        {
            return this.Internal_GetMinBitrate((int) type);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        internal extern void updateOrigData();

        [Obsolete("Setting and getting import channels is not used anymore (use forceToMono instead)", true)]
        public AudioImporterChannels channels
        {
            get
            {
                return AudioImporterChannels.Automatic;
            }
            set
            {
            }
        }

        public int compressionBitrate { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        [Obsolete("Setting/Getting decompressOnLoad is deprecated. Use AudioImporter.loadType instead.", true)]
        private bool decompressOnLoad
        {
            get
            {
                return (this.loadType == AudioImporterLoadType.DecompressOnLoad);
            }
            set
            {
                this.loadType = !value ? AudioImporterLoadType.CompressedInMemory : AudioImporterLoadType.DecompressOnLoad;
            }
        }

        internal int defaultBitrate { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        internal int durationMS { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public bool forceToMono { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        public AudioImporterFormat format { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        internal int frequency { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public bool hardware { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        public AudioImporterLoadType loadType
        {
            get
            {
                return (AudioImporterLoadType) this.Internal_GetLoadType();
            }
            set
            {
                this.Internal_SetLoadType((int) value);
            }
        }

        public bool loopable { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        internal int origChannelCount { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        internal int origFileSize { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        internal bool origIsCompressible { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        internal bool origIsMonoForcable { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        internal AudioType origType
        {
            get
            {
                return (AudioType) this.Internal_GetType();
            }
        }

        public bool threeD { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }
    }
}

